package com.tvsinfo.jdk.demo.case8_fork_join;

import java.util.List;
import java.util.concurrent.ForkJoinPool;

public class Test {

    public static void main(String[] args) {
        ForkJoinPool forkJoinPool = new ForkJoinPool();
        OrderQueryApi recursiveTaskTest=new OrderQueryApi(0,1000);
        OrderQueryApi recursiveTaskTest2=new OrderQueryApi(1000,2000);
        forkJoinPool.submit(recursiveTaskTest);
        forkJoinPool.submit(recursiveTaskTest2);
        Long startTimes=System.currentTimeMillis();
        List list=recursiveTaskTest.join();
        List list2=recursiveTaskTest.join();
        Long endTimes=System.currentTimeMillis();
        System.out.println();
        System.out.println();
        System.out.println();
        System.out.println("共计耗时："+(endTimes-startTimes));
        System.out.println();
        System.out.println();
        System.out.println();
        Test test=new Test();
        test.forTest();
    }

    public void forTest(){
        Long startTimes=System.currentTimeMillis();
        for (int i = 0; i < 2000; i++) {
            int start=i, end=i+10;
            SQLSelectDao sqlSelectDao = new SQLSelectDao();
            sqlSelectDao.selectOrderInfoList(start, end);
            i=i+10;
        }
        Long endTimes=System.currentTimeMillis();
        System.out.println("共计耗时："+(endTimes-startTimes));
    }
}
